#include <stdio.h>

struct Student {
    char num[11];       // 学号
    char name[11];      // 姓名
    int s1, s2, s3;     // 三门课程成绩
    int total;          // 总成绩
};
typedef struct Student Student;
int main() {
    int n;
    scanf("%d", &n);
    Student students[n];
    int maxTotal = 0; // 记录最高总分
    // 输入学生数据并计算总分
    for (int i = 0; i < n; i++) {
        scanf("%s %s %d %d %d",
              students[i].num, students[i].name,
              &students[i].s1, &students[i].s2, &students[i].s3);
        students[i].total = students[i].s1 + students[i].s2 + students[i].s3;
        // 更新最高总分
        if (students[i].total > maxTotal) {
            maxTotal = students[i].total;
        }
    }
    // 输出所有总分等于最高总分的学生信息
    for (int i = 0; i < n; i++) {
        if (students[i].total == maxTotal) {
            printf("%s %s %d\n", students[i].num, students[i].name, students[i].total);
        }
    }

    return 0;
}
